package com.sky1324.myspringboot.service;


import com.sky1324.myspringboot.entity.sysUser;
import com.sky1324.myspringboot.mapper.sysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

@Service
public class sysUserService {


    @Autowired
    private sysUserMapper sysUserMapper;


    public int save(sysUser sysuser){
        System.out.println("进入service"+ sysuser);
//        判断有没有id
        if (sysuser.getId() == null){
            sysUserMapper.insert( sysuser);
        }else{
            System.out.println("进入id 判断");
            sysUserMapper.updateA(sysuser);
        }

        return 0;
    }
//    s删除
    public Integer del(Integer id) {
        return  sysUserMapper.deleteByid(id);
    }

//    分页查询
    public List<sysUser> selecrPage(Integer pageNum, Integer pageSize,String username) {
        System.out.println("username" + username);
        return sysUserMapper.selectPage(pageNum,pageSize,username);
    }


    public Integer selecatTotal(String username) {
        System.out.println("username" + username);
        return sysUserMapper.selecatTotal(username);
    }
}
